#define _CRT_SECURE_NO_WARNINGS

#include "BinaryTree.h"
#include "Queue.h"

void test()
{
	BTNode* A = BTCreateNode('A');
	BTNode* B = BTCreateNode('B');
	BTNode* C = BTCreateNode('C');
	BTNode* D = BTCreateNode('D');
	BTNode* E = BTCreateNode('E');
	BTNode* F = BTCreateNode('F');
    //printf("ǰ : ");
	//BTPreOrder(root);
	//printf("\n");
	//printf(" : ");
	//BTInOrder(root);
	//printf("\n");
	//printf(" : ");
	//BTPostOrder(root);
	//printf("\n");
	//int size = 0;
	//BTSize(A, &size);
	//printf("Size == %d\n", size);
	//        A
	//    B       C
	//  D   N   E   F
	// N N     N N N N
	A->left = B;
	B->left = D;
	B->right = NULL;
	D->left = D->right = NULL;
	A->right = C;
	C->left = E;
	C->right = F;
	E->left = E->right = F->left = F->right = NULL;
	BTNode* root = A;
	BTNode* a = BTCreateNode('a');
	BTNode* b = BTCreateNode('b');
	BTNode* c = BTCreateNode('c');
	BTNode* d = BTCreateNode('d');
	BTNode* e = BTCreateNode('e');
	BTNode* f = BTCreateNode('f');
	BTNode* g = BTCreateNode('g');
	//        a
	//    b       c
	//  d   e   f   g
	// N N N N N N N N
	a->left = b;
	a->right = c;
	b->left = d;
	b->right = e;
	c->left = f;
	c->right = g;
	d->left = d->right = e->left = e->right = f->left = f->right = g->left = g->right = NULL;
	BTNode* root2 = a;
	//printf("ǰ : ");
	//BTPreOrder(root);
	//printf("\n");
	//printf(" : ");
	//BTInOrder(root);
	//printf("\n");
	//printf(" : ");
	//BTPostOrder(root);
	//printf("\n");
	//int size = 0;
	//BTSize(A, &size);
	//printf("Size == %d\n", size);
	printf("Size == %d\n", BTSize(root));
	printf("LeafSize == %d\n", BTLeafSize(root));
	printf("Level 1 Size == %d\n", BTLevelSize(root, 1));
	printf("Level 2 Size == %d\n", BTLevelSize(root, 2));
	printf("Level 3 Size == %d\n", BTLevelSize(root, 3));
	printf("Level 4 Size == %d\n", BTLevelSize(root, 4));
	printf("Hight == %d\n", BTGetHeight(root));
	BTDataType find = 'A';
	printf("Find : %p == %p\n", BTFind(root, find), A);
	BTLevelOrder(root);
	printf("\n");
	if (BTIsComplete(root))
	{
		printf("BT1 is complete.\n");
	}
	else
	{
		printf("BT1 isn't complete.\n");
	}
	if (BTIsComplete(root2))
	{
		printf("BT2 is complete.\n");
	}
	else
	{
		printf("BT2 isn't complete.\n");
	}

	BTDestory(&root);
}


int main()
{
	test();


	return 0;
}